use {
    sqlx::{MySql, Pool},
    std::sync::{Arc, Mutex},
};

#[derive(Clone)]
pub struct AppState {
    pub env: &'static str,
    pub pool: Pool<MySql>,
}

#[derive(serde::Serialize)]
pub struct Result<T> {
    pub code: i32,
    pub msg: String,
    pub data: Option<T>,
}

impl<T> Result<T> {
    pub fn ok(data: T) -> Self {
        Result {
            code: 0,
            msg: "ok".to_string(),
            data: Some(data),
        }
    }
}
